﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace Quickly.Certs.UnitTests.AliDns
{
    public class TestHelper
    {
        public static TestHelper Instance = new TestHelper();

        protected TestHelper()
        {
            ServiceProvider = BuildServiceProvider();
        }

        public virtual IServiceProvider ServiceProvider { get; set; } 

        protected virtual IServiceProvider BuildServiceProvider()
        {
            var services = new ServiceCollection();
            services.AddLogging(opt =>
            {
                opt.ClearProviders();
                opt.AddConsole();
            });

            return services.BuildServiceProvider();
        }
    }
}